Using Gentoo's `ebegin`, `eend` etc under Ubuntu

Posted by Marcus Downing on Server Fault See other posts from Server Fault or by Marcus Downing
Published on 2012-01-23T11:50:39Z Indexed on 2012/04/07 17:34 UTC
Read the original article Hit count: 269

Filed under:
|
|
|

We're quite fond of the style of the ebegin, eend, eerror, eindent etc commands used by Portage and other tools on Gentoo. The green-yellow-red bullets and standard layout make for very quick spotting of errors, on what would otherwise be very grey command line output.

#!/bin/sh
source /etc/init.d/functions.sh
ebegin "Copying data"
rsync ....
eend $?

Producing output similar to:

 * Copying data...                                                       [ OK ]

As a result we're using these commands in some of our common shell scripts, which is a problem for the people using Ubuntu and other linuxes. (linuces? linuxen? linucae? other distros)

On Gentoo these functions are provided by OpenRC, and imported with functions.sh file (whose exact position seems to vary slightly). But is there a simple way of getting these commands on Ubuntu?

In theory we could replace them all with dull echos, but we'd rather not?

© Server Fault or respective owner

Related posts about linux

Related posts about ubuntu